#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

#define BUF_SIZE 3

int main(int argc, char *argv[]){
    int fd1,fd2;
    int len;
    char buf[BUF_SIZE];
    if(argc != 3){
        printf("请输入需要复制的文件");
        exit(1);
    }
    fd1 = open(argv[1],O_RDONLY);
    fd2 = open(argv[2],O_WRONLY|O_CREAT|O_TRUNC);
    while((len = read(fd1,buf,sizeof(buf))) > 0)
        write(fd2,buf,len);
    close(fd1);
    close(fd2);
    return 0;
}